package main


import "fmt"
import "io/ioutil"
import "compiler/parser"
import "encoding/json"


func main() {

	data, err := ioutil.ReadFile("test.lua")

	if err != nil {
		panic("err")
	}

	testParser(string(data), "test.lua")

}


func testParser(chunk, chunkName string) {

	ast := parser.Parse(chunk, chunkName)
	b, err := json.Marshal(ast)
	if err != nil {
		panic(err)
	}

	fmt.Println(string(b))
}